์ž‘์„ฑ: 2024-11-27 06:30:34
    ์ˆ˜์ •: 2024-11-27 06:30:34

    ์Šคํ† ๋ฆฌ์ง€ ์„œ๋ฒ„

    Nextcloud๋Š” ํŒŒ์ผ ์ €์žฅ, ๊ณต์œ  ๋ฐ ํ˜‘์—…์„ ์œ„ํ•œ ์˜คํ”ˆ์†Œ์Šค ํด๋ผ์šฐ๋“œ ์Šคํ† ๋ฆฌ์ง€ ์†”๋ฃจ์…˜์ž…๋‹ˆ๋‹ค. ๊ฐœ์ธ ์„œ๋ฒ„์— Nextcloud๋ฅผ ์„ค์น˜ํ•˜๋ฉด ๋ฐ์ดํ„ฐ์˜ ํ”„๋ผ์ด๋ฒ„์‹œ์™€ ๋ณด์•ˆ์„ ์œ ์ง€ํ•˜๋ฉด์„œ ํด๋ผ์šฐ๋“œ ์ €์žฅ์†Œ๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜๋Š” Nextcloud๋ฅผ ์Šคํ† ๋ฆฌ์ง€ ์„œ๋ฒ„์— ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

    1. ์‹œ์Šคํ…œ ์š”๊ตฌ ์‚ฌํ•ญ

    • ์šด์˜ ์ฒด์ œ: Ubuntu 20.04 ์ด์ƒ ๋˜๋Š” CentOS 7 ์ด์ƒ
    • ์›น ์„œ๋ฒ„: Apache, Nginx ๋“ฑ
    • PHP: PHP 7.4 ์ด์ƒ
    • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค: MySQL, MariaDB, PostgreSQL ๋“ฑ

    2. ํ•„์š”ํ•œ ํŒจํ‚ค์ง€ ์„ค์น˜

    Ubuntu์—์„œ ์„ค์น˜

    sudo apt update
    sudo apt install apache2 libapache2-mod-php php php-mysql php-xml php-zip php-gd php-curl php-mbstring php-intl php-bcmath php-gmp php-json

    CentOS์—์„œ ์„ค์น˜

    sudo yum install epel-release
    sudo yum install httpd php php-mysqlnd php-xml php-zip php-gd php-curl php-mbstring php-intl php-bcmath php-gmp

    3. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ค์ •

    MySQL ๋˜๋Š” MariaDB๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

    MySQL/MariaDB ์„ค์น˜

    sudo apt install mysql-server  # Ubuntu
    sudo yum install mariadb-server  # CentOS

    ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ ์‚ฌ์šฉ์ž ์ƒ์„ฑ

    sudo mysql -u root -p
     
    CREATE DATABASE nextcloud;
    CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'your_password';
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

    4. Nextcloud ๋‹ค์šด๋กœ๋“œ

    Nextcloud์˜ ์ตœ์‹  ๋ฒ„์ „์„ ๋‹ค์šด๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

    cd /var/www
    sudo wget https://download.nextcloud.com/server/releases/nextcloud-<latest_version>.zip
    sudo unzip nextcloud-<latest_version>.zip
    sudo chown -R www-data:www-data nextcloud

    5. Apache/Nginx ์„ค์ •

    Apache ์„ค์ •

    sudo nano /etc/apache2/sites-available/nextcloud.conf

    ์•„๋ž˜ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:

    <VirtualHost *:80>
        DocumentRoot /var/www/nextcloud
        ServerName your_domain_or_IP
     
        <Directory /var/www/nextcloud/>
            Options Indexes MultiViews
            AllowOverride All
            Require all granted
        </Directory>
     
        ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
        CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
    </VirtualHost>

    ์„ค์ •์„ ํ™œ์„ฑํ™”ํ•˜๊ณ  Apache๋ฅผ ์žฌ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค:

    sudo a2ensite nextcloud.conf
    sudo a2enmod rewrite
    sudo systemctl restart apache2

    Nginx ์„ค์ •

    sudo nano /etc/nginx/conf.d/nextcloud.conf

    ์•„๋ž˜ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:

    server {
        listen 80;
        server_name your_domain_or_IP;
     
        location / {
            rewrite ^ /index.php$request_uri;
        }
     
        location ~ ^/index\.php {
            include fastcgi_params;
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # PHP ๋ฒ„์ „ ํ™•์ธ ํ•„์š”
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
     
        location ~* \.(jpg|jpeg|gif|css|png|js|ico|svg)$ {
            try_files $uri =404;
        }
    }

    Nginx๋ฅผ ์žฌ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค:

    sudo systemctl restart nginx

    6. Nextcloud ์›น ์„ค์น˜

    ์›น ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์—ด๊ณ  http://your_domain_or_IP์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค. Nextcloud ์„ค์น˜ ๋งˆ๋ฒ•์‚ฌ๊ฐ€ ๋‚˜ํƒ€๋‚˜๋ฉด ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

    1. ๊ด€๋ฆฌ์ž ๊ณ„์ • ์„ค์ •: ๊ด€๋ฆฌ์ž์˜ ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
    2. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ค์ •: MySQL/MariaDB ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
    • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‚ฌ์šฉ์ž: nextclouduser
    • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ด๋ฆ„: nextcloud
    • ๋น„๋ฐ€๋ฒˆํ˜ธ: your_password
    1. ์„ค์ • ์™„๋ฃŒ: ์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด Nextcloud ๋Œ€์‹œ๋ณด๋“œ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    7. SSL ์„ค์ • (์„ ํƒ ์‚ฌํ•ญ)

    Let's Encrypt๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ SSL์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Certbot์„ ์„ค์น˜ํ•˜๊ณ  SSL ์ธ์ฆ์„œ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

    sudo apt install certbot python3-certbot-apache  # Apache
    sudo apt install certbot python3-certbot-nginx   # Nginx

    ์ธ์ฆ์„œ ์ƒ์„ฑ:

    sudo certbot --apache  # Apache
    sudo certbot --nginx   # Nginx

    ๊ฒฐ๋ก 

    ์ด์ œ Nextcloud๊ฐ€ ์„ค์น˜๋˜์–ด ๊ฐœ์ธ ํด๋ผ์šฐ๋“œ ์Šคํ† ๋ฆฌ์ง€๋ฅผ ์šด์˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ์ผ์„ ์—…๋กœ๋“œํ•˜๊ณ , ๊ณต์œ ํ•˜๋ฉฐ, ํ˜‘์—…ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ•๋ ฅํ•œ ๋„๊ตฌ๊ฐ€ ์ค€๋น„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.